from django.urls import path
from apps.users.views import UsernameCountView, RegisterView, MobileCountView
from apps.users.views import LoginView, LogoutView, UserCenterView, EmailView
from apps.users.views import EmailVerificationView, CreateAddressView, AddressListView, UpdateDestroyAddressView
from apps.users.views import DefaultAddressView, UpdateTitleAddressView, UpdatePwdView,UserHistoryView

urlpatterns = [
    # path('usernames/<username>/count/',UsernameCountView.as_view())
    # 使用转换器
    path('usernames/<usercount:username>/count/', UsernameCountView.as_view()),
    # 注册页面路由
    path('register/', RegisterView.as_view()),
    # 手机号正则
    path('mobiles/<mobilecount:mobile>/count/', MobileCountView.as_view()),

    # 登录
    path('login/', LoginView.as_view()),
    # 退出
    path('logout/', LogoutView.as_view()),
    # 个人中心
    path('info/', UserCenterView.as_view()),

    # 更新（保存）邮箱信息
    path('emails/', EmailView.as_view()),

    # 激活邮件
    path('emails/verification/', EmailVerificationView.as_view()),

    # 浏览记录
    path('browse_histories/',UserHistoryView.as_view()),

    # 新增收货地址
    path('addresses/create/', CreateAddressView.as_view()),

    # 展示收货地址
    path('addresses/', AddressListView.as_view()),

    # 修改删除收货地址
    path('addresses/<address_id>/', UpdateDestroyAddressView.as_view()),

    # 设置默认收货地址
    path('addresses/<address_id>/default/', DefaultAddressView.as_view()),

    # 修改地址标题
    path('addresses/<address_id>/title/', UpdateTitleAddressView.as_view()),

    # 修改密码
    path('password/',UpdatePwdView.as_view()),
]
